package org.scboy.common.loads;

import org.apache.dubbo.config.annotation.DubboReference;
import org.scboy.coobi.sql.Coobi;
import org.scboy.coobi.sql.factory.EntityFactory;
import org.scboy.dbms.api.IPermissionManager;
import org.scboy.utils.caches.dbms.entity.SystemConfigEntity;
import org.springframework.boot.autoconfigure.AutoConfigureAfter;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.cache.annotation.EnableCaching;
import org.springframework.context.annotation.Configuration;

@Configuration
@EnableCaching
@AutoConfigureAfter(value = {Coobi.class,EntityFactory.class})
public class LoadSystemConfig {
	
	@DubboReference
	IPermissionManager manager;

	@Cacheable(value="DBMS_SYSCONFIG_CACHE",key="#code",unless="#result == null")
	public SystemConfigEntity getConfig(String code) {
		return manager.getSystemConfig(code);
	}
}
